package lawyer.Service;

import common.model.Propaganda;
import lawyer.repository.PropagandaRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;


@Service
public class PropagandaService {

    @Autowired
    private PropagandaRepository propagandaRepository;

    public void publishPropaganda(Propaganda propaganda) {
        propagandaRepository.save(propaganda);
    }

    public List<Propaganda> managePropaganda(Boolean approved, String type, Date publishDate, Long lawyerId) {
        return propagandaRepository.findByApprovedAndTypeAndPublishDateAndLawyerId(approved, type, publishDate, lawyerId);
    }
}